Repository navigation
Fix IsPartial check and escaping of assembly name - #1802
Merged
Merged
Conversation
Manodasan Wignarajah (manodasanW)
requested a review
from Sergio Pedri (Sergio0694)
September 28, 2024 19:14
Sergio Pedri (Sergio0694)
approved these changes
Sep 28, 2024
Member
Author
|
Failures are post build infra issues, tests passed. |
1 task done
Jakub Florkowski (kubaflo)
added a commit
to dotnet/maui
that referenced
this pull request
Nov 27, 2026
… Windows CS0117) (#40666) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change Every `main` build is currently red (for example maui-pr 1701052, maui-pr-uitests 1701137 and maui-pr-devicetests 1701071 at f38825f), and every PR inherits the failures. There's one commit per break: 1. **RS1038 fails every UI test leg.** **Caused by:** #40641 (c507118, merged 2026-11-26), which bumped `Microsoft.CodeAnalysis.Analyzers` in `UITest.Analyzers.csproj`. Seen in maui-pr-uitests 1701137. That Dependabot bump of `Microsoft.CodeAnalysis.Analyzers` from 3.3.4 to 5.12.0 brought in RS1038, which 3.3.4 didn't report. RS1038 flags an analyzer whose assembly also references `Microsoft.CodeAnalysis.Workspaces`. `UITest.Analyzers` has done that since its two IDE-only code fix providers were added with the analyzer in #23287 (July 2024), so the code didn't change; the rule is new. CI builds the UI test projects in Release, where the warning is an error, so every UI test leg fails before any test runs. Windows Debug builds only report a warning. The command-line compiler only loads the analyzer type, never the code fixes, so this PR suppresses RS1038 for this test-only project. A follow-up will move the code fixes into their own assembly so the suppression can be removed. 2. **CS0260 in the Windows `TestCases.HostApp` build.** **Caused by:** #40387 (ed7a64a, merged 2026-11-26), which changed `_17521CatDetailsPage` and `_33356CatDetailsPage` to `public partial class` in `Issues/Issue17521.cs` and `Issues/Issue33356.cs`. Seen in maui-pr 1701052 (Build Windows). The nested `[QueryProperty]` pages in `Issue17521` and `Issue33356` were made partial, but their containing `Shell` types weren't. - **Windows build failure:** the error doesn't come from the MAUI generator. The pinned `WindowsSdkPackageVersion` 10.0.19041.44 bundles CsWinRT 2.1.2. Its `WinRTAotSourceGenerator` emits a partial declaration of the containing type for every nested partial class that implements `INotifyPropertyChanged`, and all pages do. CsWinRT fixed this in microsoft/CsWinRT#1802, so the newer projections in current SDKs don't do it. I reproduced the failure with a scratch project. - **Runtime failure on every platform:** the MAUI `QueryPropertyGenerator` skips types whose containers aren't partial. It reports MAUI1200 only when the trim analyzer is enabled. Navigating to these pages then throws `InvalidOperationException` on every platform. This was hidden because the UI tests couldn't build. This PR makes both containers partial. It also makes `ShellSearchControlPage.SearchDetailPage` partial: it has `[QueryProperty]` and fails at runtime the same way. 3. **IL2121 in `RunOniOS_MauiReleaseTrimFull_CoreCLR`.** **Caused by:** #40387 (ed7a64a, merged 2026-11-26), which added `src/Controls/src/Core/Shell/QueryPropertyConversion.cs` with these IL2026 suppressions. Seen in maui-pr 1701052 (log 1304). No call in `QueryPropertyConversion.ApplyLegacyQueryProperties` or `ValidateGeneratedQueryProperties` requires unreferenced code, so their IL2026 suppressions are unused. - ILLink only adds `NoWarn IL2121` when `PublishTrimmed` is already true at evaluation. iOS trimmed builds therefore surface it. - The template app only reaches `ApplyLegacyQueryProperties`. Only generated code calls `ValidateGeneratedQueryProperties`, so any app that uses `[QueryProperty]` would hit the same IL2121 there. This PR removes both IL2026 suppressions. The IL2067 and IL2072 suppressions are still used. 4. **Essentials Windows device-test build.** **Caused by:** #36581 (c6fe1d8, merged 2026-11-25), which deleted `src/Essentials/src/MediaPicker/ImageProcessor.windows.cs`, including `RotateImageAsync`, without updating `Tests/Windows/ImageProcessor_Tests.cs`. maui-pr-devicetests 1699822 (just before it) built; 1699985 (the first build including it) failed. That PR replaced the Windows `ImageProcessor.RotateImageAsync` with the shared Graphics-based `ImageProcessor`, which broke the build with CS0117. The `WMC0001: Unknown type 'MiddleApp'` that follows is a cascade: the XAML compiler can't resolve the project's own C# types after the C# pre-compile fails. The build was green before #36581. The Issue38570 test now calls `ProcessImageToCacheFileAsync` with the options MediaPicker uses for `RotateImage = true`. It still checks the following: - the output codec chosen from the file name; - stored pixels rotated exactly once; - preserved metadata that doesn't rotate them again (oriented and stored dimensions are equal). The unchanged-stream assertion for orientation 1 is gone because processing now always writes a new file by design. **Validation (macOS arm64, SDK 12.0.100-alpha.1)** - `dotnet build src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj -c Release --no-incremental`: fails with RS1038 before the fix; 0 warnings and 0 errors after. - `dotnet test src/TestUtils/tests/UITest.Analyzers.Tests/UITest.Analyzers.Tests.csproj -c Release`: passed, 53 tests. - `dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -p:Include{Android,Ios,MacCatalyst,MacOS,Windows}TargetFrameworks=false --filter "FullyQualifiedName~ShellContentQueryParameterTests|FullyQualifiedName~ShellModalTests|FullyQualifiedName~ShellRouteTemplatesTests"`: passed, 175 tests. - Trim check: a net12.0 console app referencing the locally built `Microsoft.Maui.Controls.dll` and reaching both methods, published with `PublishTrimmed`, `TrimMode=full`, `TrimmerSingleWarn=false` and `_TrimmerShowRedundantSuppressions=true`. - Before: IL2121 for the IL2026 suppressions on both methods. - After: no IL2121 or other trim warnings from `QueryPropertyConversion`. - `QueryPropertyGenerator` run over the real `Issue17521.cs`/`Issue33356.cs` in a scratch net12.0 project with `EnableTrimAnalyzer=true`. - Before: MAUI1200 ("the containing type ... is not partial") and no generated code. - After: no diagnostics, and the `IQueryAttributable` implementations are generated. - CsWinRT check: a scratch net12.0-windows project with `WindowsSdkPackageVersion` 10.0.19041.44, a non-partial outer class and a nested partial `INotifyPropertyChanged` class. - Reproduces CS0260 from `Generator.WinRTAotSourceGenerator`. - Builds when the outer class is partial. - The rewritten `ImageProcessor_Tests.cs` compiles for net12.0-windows10.0.19041.0 in a scratch project against Windows-built Essentials and Graphics. The `origin/main` version reproduces CS0117 there. **Not validated locally, so this relies on CI:** - the Windows HostApp and Essentials.DeviceTests builds (the WinUI XAML compiler and MakePri only run on Windows); - running the Windows Issue38570 device test; - the iOS TrimFull integration test; - the UI test runs. ### Issues Fixed No separate issue. Fixes `main` build breaks introduced by #40641, #40387 and #36581. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-and@in the assembly name when using it for an identifier or namespace. This addresses that.IsPartialcheck wasn't complete where we didn't also check whether the parent classes were partial too to allow for us to generate source. Due to that, we would generate source in such cases leading to a compiler error rather than raising a diagnostic as we did when the type itself wasn't partial.GeneratedCustomBindablePropertyattribute tooFixes #1799
Fixes #1800